# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1PropertyDefinition do
  @moduledoc """
  Defines the metadata for a schema property.

  ## Attributes

  *   `dateTimeTypeOptions` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1DateTimeTypeOptions.t`, *default:* `nil`) - Date time property. It is not supported by CMEK compliant deployment.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - The display-name for the property, used for front-end.
  *   `enumTypeOptions` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1EnumTypeOptions.t`, *default:* `nil`) - Enum/categorical property.
  *   `floatTypeOptions` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1FloatTypeOptions.t`, *default:* `nil`) - Float property.
  *   `integerTypeOptions` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1IntegerTypeOptions.t`, *default:* `nil`) - Integer property.
  *   `isFilterable` (*type:* `boolean()`, *default:* `nil`) - Whether the property can be filtered. If this is a sub-property, all the parent properties must be marked filterable.
  *   `isMetadata` (*type:* `boolean()`, *default:* `nil`) - Whether the property is user supplied metadata. This out-of-the box placeholder setting can be used to tag derived properties. Its value and interpretation logic should be implemented by API user.
  *   `isRepeatable` (*type:* `boolean()`, *default:* `nil`) - Whether the property can have multiple values.
  *   `isRequired` (*type:* `boolean()`, *default:* `nil`) - Whether the property is mandatory. Default is 'false', i.e. populating property value can be skipped. If 'true' then user must populate the value for this property.
  *   `isSearchable` (*type:* `boolean()`, *default:* `nil`) - Indicates that the property should be included in a global search.
  *   `mapTypeOptions` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1MapTypeOptions.t`, *default:* `nil`) - Map property.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Required. The name of the metadata property. Must be unique within a document schema and is case insensitive. Names must be non-blank, start with a letter, and can contain alphanumeric characters and: /, :, -, _, and .
  *   `propertyTypeOptions` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1PropertyTypeOptions.t`, *default:* `nil`) - Nested structured data property.
  *   `retrievalImportance` (*type:* `String.t`, *default:* `nil`) - The retrieval importance of the property during search.
  *   `schemaSources` (*type:* `list(GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1PropertyDefinitionSchemaSource.t)`, *default:* `nil`) - The mapping information between this property to another schema source.
  *   `textTypeOptions` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1TextTypeOptions.t`, *default:* `nil`) - Text/string property.
  *   `timestampTypeOptions` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1TimestampTypeOptions.t`, *default:* `nil`) - Timestamp property. It is not supported by CMEK compliant deployment.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :dateTimeTypeOptions =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1DateTimeTypeOptions.t()
            | nil,
          :displayName => String.t() | nil,
          :enumTypeOptions =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1EnumTypeOptions.t()
            | nil,
          :floatTypeOptions =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1FloatTypeOptions.t()
            | nil,
          :integerTypeOptions =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1IntegerTypeOptions.t()
            | nil,
          :isFilterable => boolean() | nil,
          :isMetadata => boolean() | nil,
          :isRepeatable => boolean() | nil,
          :isRequired => boolean() | nil,
          :isSearchable => boolean() | nil,
          :mapTypeOptions =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1MapTypeOptions.t()
            | nil,
          :name => String.t() | nil,
          :propertyTypeOptions =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1PropertyTypeOptions.t()
            | nil,
          :retrievalImportance => String.t() | nil,
          :schemaSources =>
            list(
              GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1PropertyDefinitionSchemaSource.t()
            )
            | nil,
          :textTypeOptions =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1TextTypeOptions.t()
            | nil,
          :timestampTypeOptions =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1TimestampTypeOptions.t()
            | nil
        }

  field(:dateTimeTypeOptions,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1DateTimeTypeOptions
  )

  field(:displayName)

  field(:enumTypeOptions,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1EnumTypeOptions
  )

  field(:floatTypeOptions,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1FloatTypeOptions
  )

  field(:integerTypeOptions,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1IntegerTypeOptions
  )

  field(:isFilterable)
  field(:isMetadata)
  field(:isRepeatable)
  field(:isRequired)
  field(:isSearchable)

  field(:mapTypeOptions,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1MapTypeOptions
  )

  field(:name)

  field(:propertyTypeOptions,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1PropertyTypeOptions
  )

  field(:retrievalImportance)

  field(:schemaSources,
    as:
      GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1PropertyDefinitionSchemaSource,
    type: :list
  )

  field(:textTypeOptions,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1TextTypeOptions
  )

  field(:timestampTypeOptions,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1TimestampTypeOptions
  )
end

defimpl Poison.Decoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1PropertyDefinition do
  def decode(value, options) do
    GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1PropertyDefinition.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1PropertyDefinition do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
